﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using myTwitter.Model;
using myTwitter.BO;

namespace myTwitter
{
	/// <summary>
	/// Interaction logic for LoggedInUserInfo.xaml
	/// </summary>
	public partial class LoggedInUserInfo
	{
        public delegate void ShowUserDetailsRequestedHandler(User user);
        public event ShowUserDetailsRequestedHandler ShowUserDetailsRequested;

		public LoggedInUserInfo()
		{
			this.InitializeComponent();
		}

		private void _userPhotoBt_Click(object sender, System.Windows.RoutedEventArgs e)
		{
            User user = ((FrameworkElement)sender).DataContext as User;
            //GlobalController.Views.IMessagesControl.ShowUserDetails(user);            
            if (ShowUserDetailsRequested != null)
                ShowUserDetailsRequested(user);
		}

		private void _actions_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
		{
            if(_actions.SelectedIndex==1)
                GlobalController.SignOut();
            _actions.SelectedIndex = 0;
		}
	}
}